package com.xueyi.common.message.mq.callback.message;

import com.xueyi.common.core.utils.ServletUtils;
import com.xueyi.common.message.mq.pubsub.AbstractChannelMessage;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;

/**
 *  Message
 *
 * @author 芋道源码
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class CallbackChannelMessage extends AbstractChannelMessage {

    /**
     * 事件注册编号
     */
    private Integer eventCallbackSysNo;
    /**
     * 消息体
     */
    private String message;

    /**
     * 事件编码
     */
    private String eventCode;

    //private BpmProcessInstanceResultEvent event;


    @Override
    public String getChannel() {
        return "system.bpm-channel.callback";
    }

    public static CallbackChannelMessage setSendMessageHeaders(CallbackChannelMessage message){
        HttpServletRequest request = ServletUtils.getRequest();
        Map<String, String> headers = ServletUtils.getHeaders(request);
        message.setHeaders(headers);
        return message;
    }

}
